package com.iblog.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.log4j.Logger;

import com.iblog.bean.Message;
import com.iblog.dao.IMsgDao;

public class MsgDaoImpl implements IMsgDao{
	Logger logger = Logger.getLogger(MsgDaoImpl.class);
	private SqlSessionFactory sqlSessionFactory;

	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
		this.sqlSessionFactory = sqlSessionFactory;
	}

	public SqlSessionFactory getSqlSessionFactory() {
		return sqlSessionFactory;
	}

	@Override
	public boolean insert(Message message) {
		SqlSession sqlSession = this.getSqlSessionFactory().openSession();
		int i = sqlSession.insert("insertMsg",message);
		sqlSession.close();
		return i!=0;
		
	}

	@Override
	public boolean update(Message message) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean delete(int id) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public List<Message> selectAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int countAll() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Message findByMsgId(int id) {
		// TODO Auto-generated method stub
		return null;
	}
	
}
